package com.crm.system.controller.returnMoney;

import com.crm.common.model.DataResponse;
import com.crm.common.model.DhPageInfo;
import com.crm.common.model.DhResponse;
import com.crm.common.model.Enum.ResponseCodeEnum;
import com.crm.model.entity.returnMoney.ReturnMoney;
import com.crm.model.entity.returnMoney.ReturnMoneyLog;
import com.crm.model.vo.returnMoney.ReturnMoneyLogVO;
import com.crm.model.vo.returnMoney.ReturnMoneyVO;
import com.crm.system.service.returnMoney.ReturnMoneyLogService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Author: chaifuyou
 * @date 2021/3/24 8:53
 */
@RestController
@RequestMapping("/returnMoneyLog")
@Slf4j
public class ReturnMoneyLogController {

    @Autowired
    private ReturnMoneyLogService returnMoneyLogService;

    /**
     * 根据订单id修改回款日志
     * @param orderId
     * @return
     */
    @GetMapping("/getReturnMoneyLogList")
    public DataResponse getReturnMoneyLogList(@RequestParam(value = "pageIndex", required = true) Integer pageIndex,//页码
                                              @RequestParam(value = "pageSize", required = true) Integer pageSize,//分页大小
                                              @RequestParam String orderId){
        try{
            DhPageInfo<ReturnMoneyLogVO> logList=returnMoneyLogService.getReturnMoneyLogList(orderId,pageIndex,pageSize);
            return new DhResponse(ResponseCodeEnum.OK.getResponseCode(),logList);
        }catch(Exception e){
            log.error("returnMoneyLog get error:", e);
            return new DhResponse(ResponseCodeEnum.ERROR.getResponseCode());
        }
    }

}
